<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="apple-wap-web-app-capable" content="yes">
    <meta name="apple-wap-web-app-status-bar-style" content="black-translucent">
    <meta name="MobileOptimized" content="240"/>
    <title>邀请加入</title>
    <link rel="stylesheet" href="$!webPath/css/reset.css" />
    <link rel="stylesheet" href="$!webPath/css/style.css" />
    <link rel="stylesheet" href="$!webPath/css/style_my.css" />
    <link rel="stylesheet" href="$!webPath/css/jquery.dialogbox.css" />
    <script type="text/javascript" src="$!webPath/js/jquery.min.js" ></script>
    <script type="text/javascript" src="$!webPath/js/jquery.dialogBox.js"></script>
</head>
<body style="background-color:#fff">
<div class="all">
    <div class="inviteName">
        $!teamEntity.leaderName邀请您加入他的战队一起参加勇士勋章的比赛。
    </div>
    <div class="teamTop">
        <div class="teamAvatar">
            <div>
                #if($!teamEntity.logoPath)
                <img src="$!webPath/$!teamEntity.logoPath" width="100%" height="200">
                #else
                <img src="$!webPath/imgs/member.jpg" width="100%" height="200">
                #end
            </div>
        </div>
        <div class="teamName">
            <div>$!teamEntity.name</div>
            <div><span class="grey">积分排位赛总积分</span> $!teamEntity.teamIntegral <span class="grey">排名</span> 无</div>
            <div><span class="grey">战队成员</span> $!teamMember.size()/7 $!teamEntity.location</div>
        </div>
    </div>
    <div class="teamList">
        #foreach($obj in $!teamMember)
        <div class="teamJoinbox">
            <div class="tLAvatar">
                #if($!obj.userLocalPicPath)
                <img src="$!obj.userLocalPicPath" width="100%">
                #elseif($!obj.userWxPicPath)
                <img src="$!obj.userWxPicPath" width="100%">
                #else
                <img src="$!webPath/imgs/member.jpg" width="100%">
                #end
            </div>
            <div class="tLName tJName">
                $!obj.userName
            </div>
            <div class="tLPhone tJPhone">
                $!obj.mobile
            </div>
        </div>
        #end
    </div>
    <div class="teamFooter">
        <a href="#" class="joinBtn" onclick="return join('$!teamEntity.id')">加入</a>
    </div>
</div>
<div id="mask-dialogBox" style="display: none;color: red;font-size: 24px;font-weight: bolder;"></div>
</body>
<script>
    $(function(){
        var mar_height=$('.teamFooter').css('height');
        $('.teamList').css('margin-bottom',mar_height);
    })
    function join(id){
        jQuery.ajax({
            type: "POST",
            url: "$!webPath/team/accept_invite",
            data: {teamId:id,invitedUserId:"$!teamEntity.captionId"},
            dataType:'json',
            success: function (data) {
                alert(data.data);
                if (data.data == "success") {
                    window.location.href="$!webPath/team/accept_success?teamId="+id+"&invitedUserId="+'$!teamEntity.captionId' ;
                }else{
                    $('mask-dialogBox').css('display','block');
                    $('mask-dialogBox').html(data.data);
                }
            },
            error: function (data) {
                alert('加入失败');
            }
        })
    }
</script>
</html>